<template>
    <div id="lookMore">
        <v-nav></v-nav>
        <div class="newProductListWrapper">
            <section>
                <div :class="y%2==0?'newProductList flo-l':'newProductList flo-r'" @click="goNewDetail(x.pro_id,x.id_type)" v-for="(x,y) in list" :id="x.pro_id" :id_type="x.id_type">
                    <header>
                        <dl>
                            <dd><img :src="x.pro_image"></dd>
                            <dt style="text-align: left">{{x.pro_title}}</dt>
                        </dl>
                    </header>
                    <footer>
                        <div>
                            <span class="flo-l" style="line-height: .4rem;">
                                <span class="priceColor"style="font-size:.34rem;text-decoration: line-through;">
                                    <span class="priceColor flo-l" style="font-size:.24rem;">￥</span>
                                    {{x.pro_hprice}}
                                </span>
                            </span>
                            <button @click="goCut(x.pro_id)">砍到{{x.low_price}}元</button>
                        </div>
                    </footer>
                </div>
            </section>
        </div>
    </div>
</template>
<script>
    import config from "../config/config.js";
    import share from "../share/share.js";
    import Nav from "../home/nav.vue";
    export default{
        data(){
            return{
                showFooter:true,
                list:[]
            }
        },
      components:{
        "v-nav":Nav
      },
        methods:{
            HomeCategoryTitle(id,page){
                var value=JSON.stringify({"id":id,"page":page,"token":localStorage.getItem('token')}),
                    key=demo(value);
                axios.post('/Home/home/HomeCategoryTitle',{
                        value:value,
                        key:key

                },config)
                    .then(function(response) {
                        if(response.data.code==200){
                            this.list=response.data.data.list;
                        }
                    }.bind(this))
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            goThreekan(shareid){
                this.$router.push('/threekan/'+shareid);
            },
            goCut(id){
                var value=JSON.stringify({"sku_id":id,"token":localStorage.getItem('token')}),
                    key=demo(value);
                axios.post('/Home/cut/PushCut',{
                        value:value,
                        key:key
                },config)
                    .then(function(response) {
                        if(response.data.code==200){
                            this.goThreekan(response.data.data.shareid)
                        }
                    }.bind(this))
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            goNewDetail(id,type){
                this.$router.push('/newDetail/'+id+'/'+type)
            }
        },
        activated(){
            var id=this.$route.params.id;
            this.HomeCategoryTitle(id,1);
            share({})
        }

    }
</script>
<style>
    
</style>